﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MeetingForm.aspx.cs" Inherits="FantastPlatform.Decision.UI.MeetingForm" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script type="text/javascript">
         var mf = new FantastPlatform.UI.MeetingForm({
             renderTo: 'mf_div',
             Id: '<%=GetId() %>',
             url: '../Service/MeetingViewService.aspx?Action=Add',
             tbar: [{
                 text: '保存',
                 iconCls: 'save',
                 id:'saveNotice',
                 handler: function () { submitMeetingJson(mf, currtWind, mg); }
             }, '-', {
                 text: '重置',
                 iconCls: 'cancel',
                 id:'cancelNotice',
                 handler: function () { mf.form.reset(); }
             }]
         });
         function submitMeetingJson(form, sender, grid, fn, data) {
             if (form.form.isValid()) {
                 var myMask = new Ext.LoadMask(sender.getEl(), {
                     msg: "正在保存数据,请稍候...."
                 });                
                 var leaders = form.form.findField('Leaders').getValue();
                 var isSendMsg = form.form.findField('IsSendMsg').getValue();
                 var dataStr = Ext.util.JSON.encode(form.form.getValues());
                 if (data) {
                     dataStr = dataStr.substring(0, dataStr.length - 1) + "," + data + "}";
                 }
                 var url = '../Service/MeetingViewService.aspx?Action=Add';
                 myMask.show();
                 Ext.Ajax.request({
                     method: 'post',
                     url: url,
                     params: { data: dataStr, Leaders: leaders, IsSendMsg:isSendMsg },
                     success: onSuccess,
                     failure: onFailure
                 });
                 function onFailure(request, options) {
                     myMask.hide();
                     showErrorMessage('操作失败', request.responseText, '');
                 }
                 function onSuccess(request, options) {
                     // 服务器返回json形式的结果
                     myMask.hide();
                     var reText = request.responseText;
                     var reTextObj = Ext.util.JSON.decode(reText);
                     if (eval(reTextObj.success)) {
                         showMessage('操作成功', '保存成功');
                         if (grid)
                             updata(grid);
                         if (fn)
                             fn.call(this, reText);
                         if (sender)
                             sender.close();
                     } else {
                         showErrorMessage('操作失败', reTextObj.message, '');
                     }
                 }
             }
         }
    </script>
</head>
<body>
     <div id="mf_div">    
    </div>
</body>
</html>
